package com.bml.architect.consumer.service;

import org.apache.dubbo.config.annotation.Reference;
import org.apache.dubbo.rpc.service.GenericService;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.context.ConfigurableApplicationContext;

/**
 * 泛化
 */
//@EnableAutoConfiguration
public class GenericDemoServiceConsumer {

    @Reference(id  ="demoService",version = "generic",interfaceName = "com.bml.architect.DemoService",generic = true)
    private GenericService genericService;
    public static void main(String[] args) {
        ConfigurableApplicationContext context = SpringApplication.run(GenericDemoServiceConsumer.class);

        GenericService genericService = (GenericService) context.getBean("demoService");

        Object result = genericService.$invoke("sayHello", new String[]{"java.lang.String"}, new Object[]{"bml"});
        System.out.println(result);
    }

}
